﻿/*************************************************
作者: Plane
邮箱: 1785275942@qq.com
功能: 关卡配置文件

           ~~获取更多教学资讯~~
//----------------*----------------\\
        教学官网：www.qiqiker.com
        官方微信服务号: qiqikertuts
        Plane老师微信: PlaneZhong
\\----------------*----------------//
*************************************************/

using System.Numerics;

namespace PEProtocol {
    public class StageCfg {
        public int stageID;
        public string stageName;
        public bool isGhost;
        public string sceneName;
        public CPlayMode playMode;

        public int[] npcArr;
        public SWorldType worldType;
        public int[] mccIDArr;
        public int[] deviceIDArr;
    }
    public class NPCConfig {
        public int npcID;
        public int stageID;
        public Vector3 pos;
        public Vector3 rot;
        public string name;
        public string path;
    }
    public class DeviceConfig {
        public int deviceID;
        public Vector3 pos;
        public Vector3 rot;
        public string name;
        public string path;

        public int openCondition;
        public DeviceFunctionEnum effectEnum;
        public object[] args;
    }
    public enum DeviceFunctionEnum {
        None,
        TransMap,
        TransPos,
        OpenUI,
    }
    public enum SWorldType {
        None,
        Resident,
        TemporarySingle,
        TemporaryTeam,
        CrossRealm,//TODO 跨服战场地图
    }

    public class XlsCfgTool {
        public static StageCfg GetStageConfig(int stageID) {
            return stageID switch {
                1 => new StageCfg {
                    stageID = 1,
                    stageName = "账号登录",
                    sceneName = "001_Login",
                    playMode = CPlayMode.Login
                },
                2 => new StageCfg {
                    stageID = 2,
                    stageName = "创建角色",
                    sceneName = "002_Create",
                    playMode = CPlayMode.Create
                },
                101 => new StageCfg {
                    stageID = 101,
                    stageName = "大唐帝国",
                    isGhost = false,
                    sceneName = "101_MajorCity",
                    playMode = CPlayMode.Major,
                    npcArr = new int[] { 101001, 101002 },

                    worldType = SWorldType.Resident,
                    mccIDArr = new int[] { 10101 },
                    deviceIDArr = new[] { 101201, 101202 }
                },
                _ => null,
            };
        }

        public static NPCConfig GetNPCConfig(int npcID) {
            return npcID switch {
                101001 => new NPCConfig {
                    npcID = 101001,
                    stageID = 101,
                    pos = new Vector3(-6, 0, -6),
                    rot = new Vector3(0, 145, 0),
                    name = "夫子",
                    path = "npc_fuzi"
                },
                101002 => new NPCConfig {
                    npcID = 101002,
                    stageID = 101,
                    pos = new Vector3(6f, 0, 6f),
                    rot = new Vector3(0, 180, 0),
                    name = "大师兄",
                    path = "npc_senior"
                },
                _ => null
            };
        }
        public static DeviceConfig GetDeviceConfig(int deviceID) {
            return deviceID switch {
                101201 => new() {
                    deviceID = 101201,
                    pos = new Vector3(-8.64f, 0, -9.67f),
                    rot = new Vector3(0, 30, -9.67f),
                    name = "野外传送门",
                    path = "prop_portal",
                    openCondition = 0,
                    effectEnum = DeviceFunctionEnum.TransMap,
                    args = new object[] { 103 }
                },
                101202 => new() {
                    deviceID = 101202,
                    pos = new Vector3(0, 0, -9.67f),
                    rot = new Vector3(0, -30, -9.67f),
                    name = "世界Boss战入口",
                    path = "prop_bossfight",
                    openCondition = 2,
                    effectEnum = DeviceFunctionEnum.TransMap,
                    args = new object[] { 401 }
                },
                _ => null
            };
        }
    }
}